<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport"
        content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" type="text/css" href="./css/api.css" />
    <link rel="stylesheet" type="text/css" href="./css/aui.css" />
    <link rel="stylesheet" type="text/css" href="./css/iconfont.css" />
    <style type="text/css">
        i.iconfont {
            font-size: 1.2rem;
            color: #fff;
        }

        .aui-btn.aui-pull-right {
            font-size: 0.75rem;
        }

        .aui-btn.aui-pull-right.hidden,
        .hidden {
            display: none;
        }

        .aui-pull-right .iconAnkerwebicon- {
            font-size: 0.8rem;
        }
    </style>
</head>

<body>
    <header class="aui-bar aui-bar-nav header" id="aui-header">
        <a class="aui-btn aui-pull-left" tapmode onclick="closeWin()">
            <span class="aui-iconfont aui-icon-left"></span>
        </a>
        <div id="frametitle" class="aui-title">标题</div>
        <!-- <a class="aui-btn aui-pull-right hidden" id="right_searchpandian" tapmode onclick="do_open_searchpandian()">
            <i class="icon iconfont iconxiazai17"></i>
        </a> -->
        <!-- <a class="aui-btn aui-pull-right hidden" id="right_searchzc" tapmode onclick="do_open_searchzc()">
            <i class="icon iconfont iconxiazai17"></i>
        </a> -->
        <!-- <a class="aui-btn aui-pull-right hidden" id="right_searchzcsq" tapmode onclick="do_open_searchzcsq()">
            <i class="icon iconfont iconxiazai17"></i>
        </a> -->
        <!-- <a class="aui-btn aui-pull-right hidden" id="right_searchchoosezc" tapmode onclick="do_open_searchchoosezc()">
            <i class="icon iconfont iconxiazai17"></i>
        </a> -->
        <!-- <a class="aui-btn aui-pull-right hidden" id="right_searchwx" tapmode onclick="do_open_searchwx()">
            <i class="icon iconfont iconxiazai17"></i>
        </a> -->
        <!-- <a class="aui-btn aui-pull-right hidden" id="right_searchcz" tapmode onclick="do_open_searchcz()">
            <i class="icon iconfont iconxiazai17"></i>
        </a> -->
        <a class="aui-btn aui-pull-right hidden" id="right_add_lingyong" tapmode onclick="do_open_add_lingyong()">
            <i class="icon iconfont iconxinzeng"></i>
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_add_tuiku" tapmode onclick="do_open_add_tuiku()">
            <i class="icon iconfont iconxinzeng"></i>
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_add_borrow" tapmode onclick="do_open_add_borrow()">
            <i class="icon iconfont iconxinzeng"></i>
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_add_weixiu" tapmode onclick="do_open_add_weixiu()">
            <i class="icon iconfont iconxinzeng"></i>
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_add_chuzhi" tapmode onclick="do_open_add_chuzhi()">
            <i class="icon iconfont iconxinzeng"></i>
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_add_pandian" tapmode onclick="do_open_add_pandian()">
            <i class="icon iconfont iconxinzeng"></i>
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_add_message" tapmode onclick="do_open_add_message()">
            <i class="icon iconfont iconxinzeng"></i>
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_save_zc" tapmode onclick="do_save_zc()">
            保存
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_save_zcsq" tapmode onclick="do_save_zcsq()">
            保存
        </a>
        <!-- <a class="aui-btn aui-pull-right hidden" id="right_save_zcsq_ruku" tapmode onclick="do_save_zcsq_ruku()">
            保存
        </a> -->
        <a class="aui-btn aui-pull-right hidden" id="right_lingyong" tapmode onclick="do_save_lingyong()">
            保存
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_fenpei" tapmode onclick="do_save_fenpei()">
            保存
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_tuiku" tapmode onclick="do_save_tuiku()">
            保存
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_changelingyong" tapmode onclick="do_save_changelingyong()">
            保存
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_borrow" tapmode onclick="do_save_borrow()">
            保存
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_borrow_back" tapmode onclick="do_save_borrow_back()">
            保存
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_save_weixiu" tapmode onclick="do_save_weixiu()">
            保存
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_save_chuzhi" tapmode onclick="do_save_chuzhi()">
            保存
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_choose_location" tapmode onclick="do_save_choose_location()">
            选择
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_choosezc" tapmode onclick="do_save_choosezc()">
            选择
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_printzc" tapmode onclick="do_print_choosezc()">
            打印
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_print_zcitem" tapmode onclick="do_print_zc_item()">
            打印
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_back" tapmode onclick="do_save_borrowback()">
            归还
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_save_pandian" tapmode onclick="do_save_pandian()">
            保存
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_complete_pandiantask" tapmode
            onclick="do_save_pandiantask()">
            完成盘点
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_choose_more_company" tapmode
            onclick="do_choose_more_company()">
            选择
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_choose_more_zctype" tapmode
            onclick="do_choose_more_zctype()">
            选择
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_choose_more_dept" tapmode
            onclick="do_choose_more_dept()">
            选择
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_save_pandiantask" tapmode onclick="do_save_pandiantask()">
            保存
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_can_scan_location" tapmode onclick="do_open_scan_location()">
            <i class="icon iconfont iconAnkerwebicon-"></i>
        </a>
    </header>

    <script type="text/javascript" src="./script/api.js "></script>
    <script type="text/javascript">
        window._onclose = null;
        window.closeWin = function () {
            api.closeWin();
        };
        window.do_open_add_message = function () {
            api.sendEvent({
                name: 'do_open_add_message'
            });
        }
        window.do_open_scan_location = function () {
            api.sendEvent({
                name: 'do_open_scan_location'
            });
        }
        window.do_choose_more_zctype = function () {
            api.sendEvent({
                name: 'do_choose_more_zctype'
            });
        }
        window.do_open_searchpandian = function () {
            api.sendEvent({
                name: 'do_open_searchpandian'
            });
        }
        window.do_choose_more_company = function () {
            api.sendEvent({
                name: 'do_choose_more_company'
            });
        }
        window.do_choose_more_dept = function () {
            api.sendEvent({
                name: 'do_choose_more_dept'
            });
        }
        window.do_save_pandiantask = function () {
            api.sendEvent({
                name: 'do_save_pandiantask'
            });
        }
        window.do_open_searchzc = function () {
            api.sendEvent({
                name: 'do_open_searchzc'
            });
        }
        window.do_open_searchzcsq = function () {
            api.sendEvent({
                name: 'do_open_searchzcsq'
            });
        }
        window.do_open_searchchoosezc = function () {
            api.sendEvent({
                name: 'do_open_searchchoosezc'
            });
        }
        window.do_open_searchwx = function () {
            api.sendEvent({
                name: 'do_open_searchwx'
            });
        }
        window.do_open_searchcz = function () {
            api.sendEvent({
                name: 'do_open_searchcz'
            });
        }
        window.do_open_add_lingyong = function () {
            api.sendEvent({
                name: 'do_open_add_lingyong'
            });
        }
        window.do_open_add_tuiku = function () {
            api.sendEvent({
                name: 'do_open_add_tuiku'
            });
        }
        window.do_open_add_borrow = function () {
            api.sendEvent({
                name: 'do_open_add_borrow'
            });
        }
        window.do_save_zc = function () {
            api.sendEvent({
                name: 'do_save_zc'
            });
        }
        window.do_save_zcsq = function () {
            api.sendEvent({
                name: 'do_save_zcsq'
            });
        }
        window.do_save_zcsq_ruku = function () {
            api.sendEvent({
                name: 'do_save_zcsq_ruku'
            });
        }
        window.do_save_lingyong = function () {
            api.sendEvent({
                name: 'do_save_lingyong'
            });
        }
        window.do_save_fenpei = function () {
            api.sendEvent({
                name: 'do_save_fenpei'
            });
        }
        window.do_save_tuiku = function () {
            api.sendEvent({
                name: 'do_save_tuiku'
            });
        }
        window.do_save_changelingyong = function () {
            api.sendEvent({
                name: 'do_save_changelingyong'
            });
        }
        window.do_save_borrow = function () {
            api.sendEvent({
                name: 'do_save_borrow'
            });
        }
        window.do_save_borrow_back = function () {
            api.sendEvent({
                name: 'do_save_borrow_back'
            });
        }
        window.do_save_weixiu = function () {
            api.sendEvent({
                name: 'do_save_weixiu'
            });
        }
        window.do_save_chuzhi = function () {
            api.sendEvent({
                name: 'do_save_chuzhi'
            });
        }
        window.do_save_choose_location = function () {
            api.sendEvent({
                name: 'do_save_choose_location'
            });
        }
        window.do_save_choosezc = function () {
            api.sendEvent({
                name: 'do_save_choosezc'
            });
        }
        window.do_print_choosezc = function () {
            api.sendEvent({
                name: 'do_print_choosezc'
            });
        }
        window.do_print_zc_item = function () {
            api.sendEvent({
                name: 'do_print_zc_item'
            });
        }
        do_print_zc_item
        window.do_save_borrowback = function () {
            api.sendEvent({
                name: 'do_save_borrowback'
            });
        }
        window.do_open_add_weixiu = function () {
            api.sendEvent({
                name: 'do_open_add_weixiu'
            });
        }
        window.do_open_add_chuzhi = function () {
            api.sendEvent({
                name: 'do_open_add_chuzhi'
            });
        }
        window.do_open_add_pandian = function () {
            api.sendEvent({
                name: 'do_open_add_pandian'
            });
        }
        window.do_save_pandian = function () {
            api.sendEvent({
                name: 'do_save_pandian'
            });
        }
        apiready = function () {
            var header = $api.byId('aui-header');
            var statusBar = api.require('statusBar');
            var statusBarHeight = statusBar.getStatusBarHeight();
            if (statusBarHeight > 25) {
                $api.css(header, 'border-top: solid ' + statusBarHeight + 'px #000;');
            }
            // $api.fixStatusBar(header);
            var headerH = $api.offset(header).h;
            var frameH = api.winHeight;
            var url = api.pageParam.url;
            var title = api.pageParam.title;
            var pageParam = {
                header_h: headerH,
            }
            Object.keys(api.pageParam).forEach(function (key) {
                if (key != 'title' && key != 'url') {
                    pageParam[key] = api.pageParam[key];
                }
            });
            if (pageParam.canaddmessage) {
                $api.toggleCls($api.byId('right_add_message'), 'hidden');
            }
            if (pageParam.canscanpdlocation) {
                $api.toggleCls($api.byId('right_can_scan_location'), 'hidden');
            }
            if (pageParam.cansearchpandian) {
                $api.toggleCls($api.byId('right_searchpandian'), 'hidden');
            }
            if (pageParam.canchoosemorecompany) {
                $api.toggleCls($api.byId('right_choose_more_company'), 'hidden');
            }
            if (pageParam.canchoosemoredept) {
                $api.toggleCls($api.byId('right_choose_more_dept'), 'hidden');
            }
            if (pageParam.canchoosemorezctype) {
                $api.toggleCls($api.byId('right_choose_more_zctype'), 'hidden');
            }
            if (pageParam.cansavepandiantask) {
                $api.toggleCls($api.byId('right_save_pandiantask'), 'hidden');
            }
            // if (pageParam.cansearchzc) {
            //     $api.toggleCls($api.byId('right_searchzc'), 'hidden');
            // }
            // if (pageParam.cansearchzcsq) {
            //     $api.toggleCls($api.byId('right_searchzcsq'), 'hidden');
            // }
            // if (pageParam.cansearchchoosezc) {
            //     $api.toggleCls($api.byId('right_searchchoosezc'), 'hidden');
            // }
            // if (pageParam.cansearchwx) {
            //     $api.toggleCls($api.byId('right_searchwx'), 'hidden');
            // }
            // if (pageParam.cansearchcz) {
            //     $api.toggleCls($api.byId('right_searchcz'), 'hidden');
            // }
            if (pageParam.canaddlingyong) {
                $api.toggleCls($api.byId('right_add_lingyong'), 'hidden');
            }
            if (pageParam.canaddtuiku) {
                $api.toggleCls($api.byId('right_add_tuiku'), 'hidden');
            }
            if (pageParam.canaddborrow) {
                $api.toggleCls($api.byId('right_add_borrow'), 'hidden');
            }
            if (pageParam.canaddweiuxiu) {
                $api.toggleCls($api.byId('right_add_weixiu'), 'hidden');
            }
            if (pageParam.canaddchuzhi) {
                $api.toggleCls($api.byId('right_add_chuzhi'), 'hidden');
            }
            if (pageParam.canaddpandian) {
                $api.toggleCls($api.byId('right_add_pandian'), 'hidden');
            }
            if (pageParam.cansave) {
                $api.toggleCls($api.byId('right_save_zc'), 'hidden');
            }
            if (pageParam.cansavezcsq) {
                $api.toggleCls($api.byId('right_save_zcsq'), 'hidden');
            }
            // if (pageParam.cansavezcsqruku) {
            //     $api.toggleCls($api.byId('right_save_zcsq_ruku'), 'hidden');
            // }
            if (pageParam.canlingyong) {
                $api.toggleCls($api.byId('right_lingyong'), 'hidden');
            }
            if (pageParam.canfenpei) {
                $api.toggleCls($api.byId('right_fenpei'), 'hidden');
            }
            if (pageParam.cantuiku) {
                $api.toggleCls($api.byId('right_tuiku'), 'hidden');
            }
            if (pageParam.cansaveweixiu) {
                $api.toggleCls($api.byId('right_save_weixiu'), 'hidden');
            }
            if (pageParam.cansavechuzhi) {
                $api.toggleCls($api.byId('right_save_chuzhi'), 'hidden');
            }
            if (pageParam.canchangelingyong) {
                $api.toggleCls($api.byId('right_changelingyong'), 'hidden');
            }
            if (pageParam.canborrow) {
                $api.toggleCls($api.byId('right_borrow'), 'hidden');
            }
            if (pageParam.canborrowback) {
                $api.toggleCls($api.byId('right_borrow_back'), 'hidden');
            }
            // if (pageParam.canchooselocation) {
            //     $api.toggleCls($api.byId('right_choose_location'), 'hidden');
            // }
            if (pageParam.canchoosezc) {
                $api.toggleCls($api.byId('right_choosezc'), 'hidden');
            }
            if (pageParam.canprintzc) {
                $api.toggleCls($api.byId('right_printzc'), 'hidden');
            }
            if (url.indexOf('zcedit_frm') > -1) {
                $api.toggleCls($api.byId('right_print_zcitem'), 'hidden');
            }
            if (pageParam.canback) {
                $api.toggleCls($api.byId('right_back'), 'hidden');
            }
            if (pageParam.cansavepandian) {
                $api.toggleCls($api.byId('right_save_pandian'), 'hidden');
            }
            // api.addEventListener({
            //     name: 'do_start_edit'
            // }, function(ret) {
            //     if (url == 'html/zcedit_frm.html' || url == 'html/weixiuedit_frm.html' || url == 'html/chuzhiedit_frm.html') {
            //         var saveElem = $api.byId('right_save');
            //         if ($api.hasCls(saveElem, 'hidden')) {
            //             $api.removeCls(saveElem, 'hidden');
            //         }
            //     }
            // });
            // api.addEventListener({
            //     name: 'do_start_edit_weixiu'
            // }, function(ret) {
            //     var saveElem = $api.byId('right_save');
            //     if ($api.hasCls(saveElem, 'hidden')) {
            //         $api.removeCls(saveElem, 'hidden');
            //     }
            // });
            // api.addEventListener({
            //     name: 'do_start_edit_zc'
            // }, function(ret) {
            //     var saveElem = $api.byId('right_save_zc');
            //     if ($api.hasCls(saveElem, 'hidden')) {
            //         $api.removeCls(saveElem, 'hidden');
            //     }
            // });
            // api.addEventListener({
            //     name: 'do_start_edit_chuzhi'
            // }, function(ret) {
            //     var saveElem = $api.byId('right_save_chuzhi');
            //     if ($api.hasCls(saveElem, 'hidden')) {
            //         $api.removeCls(saveElem, 'hidden');
            //     }
            // });
            if (url && url.length > 0 && url[0] != '.' && url[0] != '/' && url[0] != '\\') {
                if (url.indexOf('http://') < 0 && url.indexOf('https://') < 0) {
                    url = 'html/' + url;
                }
            }

            window._onclose = api.pageParam.onclose;
            api.openFrame({
                name: "main",
                url: url,
                bounces: false,
                pageParam: pageParam,
                rect: {
                    x: 0,
                    y: headerH,
                    w: 'auto',
                    h: frameH - headerH,
                }
            });
            $api.dom(header, '#frametitle').innerText = title;
            api.addEventListener({
                name: 'keyback'
            }, function (ret, err) {
                if (ret) {
                    window.closeWin();
                }
            });
            api.addEventListener({
                name: 'showchulibtn'
            }, function () {
                $api.toggleCls($api.byId('detaillist'), 'hidden');
            });
            setTimeout(function () {
                api.sendEvent({
                    name: 'do_close_scan',
                    extra: {
                        isclose: true
                    }
                });
            }, 500);
        };
    </script>
</body>

</html>